# Contributor: 6543 <6543@obermui.de>
# Maintainer: 6543 <6543@obermui.de>
pkgname=py3-matrix-common
pkgver=1.2.1
pkgrel=0
pkgdesc="Common utilities for Synapse, Sydent and Sygnal"
url="https://github.com/matrix-org/matrix-python-common"
arch="noarch"
license="Apache-2.0"
depends="python3"
depends="python3 py3-attrs"
makedepends="
	py3-build
	py3-installer
	py3-setuptools
	py3-wheel
	"
checkdepends="py3-twisted"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/matrix-org/matrix-python-common/archive/refs/tags/v$pkgver.tar.gz
	"
builddir="$srcdir/matrix-python-common-$pkgver"

build() {
	python3 -m build --no-isolation --wheel
}

check() {
	python3 -m installer -d testenv \
		dist/matrix_common-$pkgver-py3-none-any.whl
	local sitedir="$(python3 -c 'import site;print(site.getsitepackages()[0])')"
	PATH="$PWD/testenv/usr/bin:$PATH" PYTHONPATH="$PWD/testenv/$sitedir" python3 -m twisted.trial tests
}

package() {
	python3 -m installer -d "$pkgdir" \
		dist/matrix_common-$pkgver-py3-none-any.whl
}

sha512sums="
9ab05d6aeddf4915970916d34e625b7a059823e56ba8868f955cf8971a51ac31891304a7fb00170c60c6b107f7526565f67bd78416a466c50092954c5b422114  py3-matrix-common-1.2.1.tar.gz
"
